using CthulhuDomain.GameEntities;

namespace CthulhuDomain.Strategies
{
  public class VerticalMovement : MovementStrategy
  {
    public DomainEntity.eDirection Direction { get; set; }
    
    public VerticalMovement(DomainEntity subject) : base(subject) { }

    public VerticalMovement(DomainEntity subject, DomainEntity.eDirection direction) : base(subject)
    {
      Direction = direction;
    }

    public override void Move(IRectangle context)
    {
      Vector2Adapter newPosition= null;
      switch (Direction)
      {
        case DomainEntity.eDirection.Up:
          newPosition = new Vector2Adapter(Subject.Position.X, Subject.Position.Y - Subject.Speed);
          break;
        case DomainEntity.eDirection.Down:
          newPosition = new Vector2Adapter(Subject.Position.X, Subject.Position.Y + Subject.Speed);
          break;
      }
      Subject.Position = newPosition;
    }
  }
}